package com.atguigu.gmall.user.controller;

import com.atguigu.gmall.common.util.AuthContextHolder;
import com.atguigu.gmall.model.user.UserAddress;
import com.atguigu.gmall.user.service.UserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Auther 赵乾坤
 * @Date 2021-01-06 8:50
 * 用户信息
 *  *  收货地址信息
 */
@RestController
@RequestMapping("/api/user")
public class UserInfoController {

    @Autowired
    private UserAddressService userAddressService;

    //查询收货地址集合
    @GetMapping("/findUserAddress")
    public List<UserAddress> findUserAddress(HttpServletRequest request) {
        String userId = AuthContextHolder.getUserId(request);
        return userAddressService.findUserAddress(userId);
    }
}
